package com.mall.controller;


import com.github.wxpay.sdk.WXPayUtil;
import com.mall.entity.Orders;
import com.mall.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.ServletInputStream;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

@RestController
@RequestMapping("/pay")
public class PayController {
    @Autowired
    private OrderService orderService;
    //回调接口，当 用户支付成功之后，微信支付平台就会请求这个接口，将支付状态的数据传递过来
    @RequestMapping("/callback")
    public String callback(HttpServletRequest request) throws Exception {
        System.out.println("-----------callback----------");
        return  orderService.callback(request);
        }
    }
















